﻿using System;
using System.Text;

namespace WeaverCustomTool
{
    public partial class CustomTool
    {
        public override string GetDefaultExtension()
        {
            return ".weaved.cs";
        }

        protected override byte[] GenerateCode(string inputFileName, string inputFileContent)
        {
            try
            {
                var stringCode = Weaver.Weave(inputFileContent).GenerateSourceCode();
                return Encoding.ASCII.GetBytes(stringCode);
            }
            catch(Exception e)
            {
                return Encoding.ASCII.GetBytes(e.Message);
            }
        }
    }
}
